# RUN: llc -mtriple=arm-- -run-pass=machine-outliner -verify-machineinstrs \
# RUN: %s -o - | FileCheck %s

--- |
  define void @stack_use_no_lr_save_1() #0 { ret void }
  define void @stack_use_no_lr_save_2() #0 { ret void }

  attributes #0 = { minsize optsize }
...
---

name:           stack_use_no_lr_save_1
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name:           stack_use_no_lr_save_1
    ; CHECK: BL @OUTLINED_FUNCTION_0
    $r0 = MOVi 1, 14, $noreg, $noreg
    $r0 = MOVi 1, 14, $noreg, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = MOVi 1, 14, $noreg, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = MOVi 1, 14, $noreg, $noreg
  bb.1:
    liveins: $r0, $r1, $r2, $r3, $r4, $r5, $r6, $r7, $r8, $r9, $r10, $r11
    BX_RET 14, $noreg
...
---

name:           stack_use_no_lr_save_2
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name:           stack_use_no_lr_save_2
    ; CHECK: BL @OUTLINED_FUNCTION_0
    $r0 = MOVi 1, 14, $noreg, $noreg
    $r0 = MOVi 1, 14, $noreg, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = MOVi 1, 14, $noreg, $noreg
    $r0 = LDRi12 $sp, 0, 14, $noreg
    $r0 = MOVi 1, 14, $noreg, $noreg
  bb.1:
    BX_RET 14, $noreg

    ;CHECK: name:           OUTLINED_FUNCTION_0
    ;CHECK: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
    ;CHECK-NEXT: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
    ;CHECK-NEXT: $r0 = LDRi12 $sp, 0, 14 /* CC::al */, $noreg
    ;CHECK-NEXT: $r0 = LDRi12 $sp, 0, 14 /* CC::al */, $noreg
    ;CHECK-NEXT: $r0 = LDRi12 $sp, 0, 14 /* CC::al */, $noreg
    ;CHECK-NEXT: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
    ;CHECK-NEXT: $r0 = LDRi12 $sp, 0, 14 /* CC::al */, $noreg
    ;CHECK-NEXT: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
    ;CHECK-NEXT: MOVPCLR 14 /* CC::al */, $noreg
